﻿using Ruici.BLL;
using Ruici.Web.Services.Model;
using RuiciWebSite.Common;
using RuiciWebSite.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace RuiciWebSite.Controllers
{
    public class DistinctMedicalController : Controller
    {
        DocumentBll document = new DocumentBll();
        // GET: DistMedical
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 获取肺癌相关文章
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetLungCancerDocumentList()
        {
            int iTotalCount = 0;
            List<ArticleResponse> articleList = document.GetArticleList("specialist", 98, 100, 1, "", out iTotalCount);
            if (articleList != null)
                return Json(articleList, JsonRequestBehavior.AllowGet);

            return Json(new ReturnCode(-1, "没有找到相关文章"), JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取脂肪肝相关文章
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetFattyLiverDocumentList()
        {
            int iTotalCount = 0;
            List<ArticleResponse> articleList = document.GetArticleList("specialist", 100, 100, 1, "", out iTotalCount);
            if (articleList != null)
                return Json(articleList, JsonRequestBehavior.AllowGet);

            return Json(new ReturnCode(-1, "没有找到相关文章"), JsonRequestBehavior.AllowGet);
        }
        [HttpGet]
        public JsonResult GetSportsMecialDocumentList()
        {
            int iTotalCount = 0;
            List<ArticleResponse> articleList = document.GetArticleList("specialist", 101, 100, 1, "", out iTotalCount);
            if (articleList != null)
                return Json(articleList, JsonRequestBehavior.AllowGet);

            return Json(new ReturnCode(-1, "没有找到相关文章"), JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取缪小辉相关文章
        /// </summary>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetMiaoXiaoHuiDocumentList(PageInfoViewModel pageInfo)
        {
            int iTotalCount = 0;
            List<ArticleResponse> articleList = document.GetArticleList("specialist", 218, 100, 1, "", out iTotalCount);
            if (articleList != null)
                return Json(articleList, JsonRequestBehavior.AllowGet);

            return Json(new ReturnCode(-1, "没有找到相关文章"), JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取类别列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonResult GetCategoriesList()
        {
            List<ArticleCategoryResponse> CategoryList= document.GetCategories("specialist", 0);
  
            if (CategoryList != null)
                return Json(CategoryList, JsonRequestBehavior.AllowGet);

            return Json(new ReturnCode(-1, "没有找到相关内容"), JsonRequestBehavior.AllowGet);
        }     
    }
}